package dbaproj.pojo;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

public class Raktar {
	private String isbn;
	private Aruhaz aruhaz;
	private int darab;
	
	public Raktar(String isbn, Aruhaz aruhaz, int darab) {
		this.isbn = isbn;
		this.aruhaz = aruhaz;
		this.darab = darab;
	}
	
	public Raktar(ResultSet rs, List<Aruhaz> aruhazak) {
		try {
			isbn = rs.getString(1);
			long aruhaz_id = rs.getLong(2);
			for (Aruhaz a : aruhazak) {
				if (a.getId() == aruhaz_id) {
					aruhaz = a;
					break;
				}
			}
			darab = rs.getInt(3);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public String getIsbn() {
		return isbn;
	}
	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}
	public Aruhaz getAruhaz() {
		return aruhaz;
	}
	public void setAruhaz(Aruhaz aruhaz) {
		this.aruhaz = aruhaz;
	}
	public int getDarab() {
		return darab;
	}
	public void setDarab(int darab) {
		this.darab = darab;
	}
	
}
